<html>
<head><meta charset="utf-8"><title>Set sysroot for clippy · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html">Set sysroot for clippy</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="245379608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245379608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245379608">(Jul 08 2021 at 22:24)</a>:</h4>
<p>How do I tell clippy what sysroot to use? Or I guess, how do I solve for </p>
<div class="codehilite"><pre><span></span><code>dyld: Library not loaded: @rpath/librustc_driver-789dca9218a3e34b.dylib
</code></pre></div>
<p>The <code>clippy-driver</code> binary is not next to a <code>rustc</code> binary so I'm trying to tell it how to figure out where it is :D</p>



<a name="245380598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245380598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245380598">(Jul 08 2021 at 22:37)</a>:</h4>
<p>Ah, setting <code>LD_LIBRARY_PATH</code> and/or <code>DYLD_LIBRARY_PATH</code> seems to fix the issue.</p>



<a name="245381195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245381195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245381195">(Jul 08 2021 at 22:45)</a>:</h4>
<p>But it seems odd that there's no <code>--sysroot</code> option</p>



<a name="245702487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245702487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245702487">(Jul 12 2021 at 15:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="343063">UebelAndre</span> <a href="#narrow/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy/near/245381195">said</a>:</p>
<blockquote>
<p>But it seems odd that there's no <code>--sysroot</code> option</p>
</blockquote>
<p>There should be. This is also tested in our CI: <a href="https://github.com/rust-lang/rust-clippy/blob/cb16543b3a3ee3769dc07ca191e15988758ced0e/.github/driver.sh#L14">https://github.com/rust-lang/rust-clippy/blob/cb16543b3a3ee3769dc07ca191e15988758ced0e/.github/driver.sh#L14</a></p>
<p>Do you have a reproducer?</p>



<a name="245734461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245734461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245734461">(Jul 12 2021 at 19:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy/near/245702487">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="343063">UebelAndre</span> <a href="#narrow/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy/near/245381195">said</a>:</p>
<blockquote>
<p>But it seems odd that there's no <code>--sysroot</code> option</p>
</blockquote>
<p>There should be. This is also tested in our CI: <a href="https://github.com/rust-lang/rust-clippy/blob/cb16543b3a3ee3769dc07ca191e15988758ced0e/.github/driver.sh#L14">https://github.com/rust-lang/rust-clippy/blob/cb16543b3a3ee3769dc07ca191e15988758ced0e/.github/driver.sh#L14</a></p>
<p>Do you have a reproducer?</p>
</blockquote>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code><span class="ch">#!/bin/bash</span>

wget https://static.rust-lang.org/dist/rustc-1.53.0-x86_64-apple-darwin.tar.gz <span class="o">&amp;&amp;</span> tar -xf rustc-1.53.0-x86_64-apple-darwin.tar.gz
wget https://static.rust-lang.org/dist/clippy-1.53.0-x86_64-apple-darwin.tar.gz <span class="o">&amp;&amp;</span> tar -xf clippy-1.53.0-x86_64-apple-darwin.tar.gz

./clippy-1.53.0-x86_64-apple-darwin/clippy-preview/bin/clippy-driver --sysroot ./rustc-1.53.0-x86_64-apple-darwin/rustc --version
</code></pre></div>
<p>This will produce</p>
<div class="codehilite"><pre><span></span><code>dyld: Library not loaded: @rpath/librustc_driver-789dca9218a3e34b.dylib
  Referenced from: /Users/user/Code/./clippy-1.53.0-x86_64-apple-darwin/clippy-preview/bin/clippy-driver
  Reason: image not found
</code></pre></div>



<a name="245757098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245757098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245757098">(Jul 12 2021 at 22:13)</a>:</h4>
<p>Sorry for the delay <span class="user-mention" data-user-id="264664">@flip1995</span>  <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="245811419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Set%20sysroot%20for%20clippy/near/245811419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Set.20sysroot.20for.20clippy.html#245811419">(Jul 13 2021 at 11:38)</a>:</h4>
<p><span class="user-mention" data-user-id="343063">@UebelAndre</span> I think there's a misunderstanding. The <code>--sysroot</code> arguments is there to find the <code>std</code> lib that should be used for compilation. This has nothing to do with finding the <code>rustc_driver</code>. To fix this, either copy the clippy binaries to the <code>bin</code> dir in the extracted <code>rustc-1.53.0-.../rustc</code> dir and execute them from there, or set the <code>LD_LIBRARY_PATH</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>